﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MasMembers.DAL;

namespace MasMembers
{
    
    public partial class SelectGroupDialoge : Form
    {

        public MainForm mainForm;

        public SelectGroupDialoge()
        {
            InitializeComponent();
        }

        private void SelectMemberDialoge_Load(object sender, EventArgs e)
        {
            List<GroupsNamesEntity> groups = GroupsNames.GetAllGroups();
            gridGroups.DataSource = groups;
            
        }

        private void gridGroups_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex != -1 && e.ColumnIndex != -1)
            {
                mainForm.txtGroup.Text = ((List<GroupsNamesEntity>)gridGroups.DataSource)[e.RowIndex].G_Name;
                this.Close();
            }
        }
    }
}
